package entities.assertion;

import option.KBVocabulary;
import entities.Individual;
import entities.concept.Concept;

public class ConceptAssertion extends Assertion {
	private final Individual a;
	private final Concept concept;

	public ConceptAssertion(Individual a, Concept c) {
		this.concept = c;
		this.a = a;
	}

	public Individual getIndividual() {
		return this.a;
	}

	public Concept getConcept() {
		return this.concept;
	}

	@Override
	public String toString() {
		return this.a + " : " + this.concept;
	}

	@Override
	public String toSerializedString() {
		return " (" + KBVocabulary.CONASSERT + " " + this.a.getName() + " "
				+ this.concept.toSerializedString() + ") ";
	}


	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((a == null) ? 0 : a.hashCode());
		result = prime * result + ((concept == null) ? 0 : concept.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (!(obj instanceof ConceptAssertion))
			return false;
		ConceptAssertion other = (ConceptAssertion) obj;
		if (a == null) {
			if (other.a != null)
				return false;
		} else if (!a.equals(other.a))
			return false;
		if (concept == null) {
			if (other.concept != null)
				return false;
		} else if (!concept.equals(other.concept))
			return false;
		return true;
	}

}
